package cn.net.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;

/**
 * Created by hqj on 2022/9/13.
 */
public class test {

    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i < 101; i++) {
            sum += i;
        }
        System.out.println(sum);
        System.out.println(sum(100));

        C c = new C();
        B b = (B) c;
        A a = new A();
        A a1 = new B();

        double abc = 3.9d;
        int efg = (int) abc;
        System.out.println(2 % 2);

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            Date aDate = simpleDateFormat.parse("2022-11-07 08:50:00");
            Date bDate = simpleDateFormat.parse("2022-11-07 18:27:00");
            long aaa = aDate.getTime();
            long bbb = bDate.getTime();
            System.out.println("aaa=====" + aaa / 1000);
            System.out.println("bbb=====" + bbb / 1000);
            System.out.println("ssssss=====" + simpleDateFormat.format(new Date(1667876736 * 1000L)));
            Date date = new Date(1665561771000L);
            System.out.println("ssssss=====" + simpleDateFormat.format(date));
            int day = 6;
            Double result = Math.ceil((double) day / 7);
            System.out.println(result.intValue());
            HashSet<Integer> sets = new HashSet();
            sets.add(1);
            sets.add(2);
            sets.add(1);
            sets.remove(5);
            sets.remove(1);
            System.out.println(sets.toString());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    protected static int sum(int n) {
        int result = 0;
        result = n * (n + 1) / 2;
        return result;
    }
}
